var netTool
var apiPath = 'capi/V2/ER_VIP_Packge/erVipPackage/'
 

function ERVIP(_netTool) {
	netTool = _netTool
	this.recharge = function(amount, fn) {
		netTool.getAjaxUrlValueBackground('/capi/mobile/recharge', {
			amount: amount,
			user_id: uni.getStorageSync('user_id'),
			remark: '加油手续费',
		}, function(res) {
			typeof fn == 'function' && fn(res);
		})
	}
	// status
	// 订单状态：1，已下单；2，开始加油进行中3，加完油；  4, 取消；
	this.save = function(data, fn) {
		netTool.getAjaxUrlValueBackground(apiPath + 'save', {
			...data,
			owner_id: uni.getStorageSync('user_id'),
			status: 1,
		}, function(res) {
			typeof fn == 'function' && fn(res);
		})
	}
	this.update = function(data, fn) {
		netTool.getAjaxUrlValueBackground(apiPath + 'update', {
			user_id: '',
			...data,
		}, function(res) {
			typeof fn == 'function' && fn(res);
		})
	}
	this.list = function(data, fn) {
		netTool.getAjaxUrlValue(apiPath + 'list', {   
			...data
		}, function(res) {
			typeof fn == 'function' && fn(res);
		})
	}
 
	this.findById = function(data, fn) {
		netTool.getAjaxUrlValueBackground(apiPath + 'findById', {
			// owner_id: uni.getStorageSync('user_id'),
			...data
		}, function(res) {
			typeof fn == 'function' && fn(res);
		})
	}




}
module.exports = ERVIP;
